package com.stx.hotkey.worker.netty.dashboard;

import com.stx.hotkey.common.model.HotKeyMsg;
import com.stx.hotkey.common.model.MsgBuilder;
import com.stx.hotkey.common.model.typeenum.MessageType;
import io.netty.channel.Channel;

public class DashboardHolder {

    /**
     * 是否连接上了Dashboard
     */
    public static boolean hasConnected = false;

    /**
     * channel
     */
    public static Channel channel = null;

    public static void flushToDashboard(String message){
        HotKeyMsg hotKeyMsg = new HotKeyMsg(MessageType.REQUEST_HOT_KEY);
        hotKeyMsg.setBody(message);
        channel.writeAndFlush(MsgBuilder.buildByteBuf(hotKeyMsg));
    }
}
